package com.dyit;

import org.springframework.core.convert.converter.Converter;
import org.springframework.format.datetime.DateFormatter;

import java.util.Date;
import java.util.Locale;

public class dateConvent implements Converter<String, Date> {


    @Override
    public Date convert(String s) {
        Date date = null;

        try {
            date = new DateFormatter("yyyy-MM-dd").parse(s, Locale.CHINA);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return date;
    }
}
